<%@include file="cabecera.jsp"%>
<%@page
	import="java.util.ArrayList,java.util.Collection,javaroke.modelo.Local,javaroke.modelo.Administrador,javaroke.negocio.GestionLocal,javaroke.negocio.GestionAdministrador"%>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<title>Bootstrap, from Twitter</title>

<script src="js/jquery-1.10.2.js"></script>
<script src="js/jquery-ui-1.10.3.js"></script>
<script src="js/bootstrap.js"></script>

<!-- Le styles -->
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<link href="css/bootswatch.css" rel="stylesheet">
<link href="css/jquery-ui-1.10.3.css" rel="stylesheet">


<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->


<p>
	<strong>Mantenimiento de Locales&gt; Edicion</strong>
</p>

<form id="form1" name="form1" method="post" action="EditarLocalServlet">
	<table width="780" height="250">
		<tr>
			<td width="160">&nbsp;</td>
			<td width="610">&nbsp;</td>
		</tr>

		<tr>
			<td><em>Id Local:</em></td>
			<td>
				<%
					int idreg = Integer.parseInt(request.getParameter("id1"));
					GestionLocal negocio = new GestionLocal();
					Local reg = negocio.obtener(idreg);
					request.setAttribute("regLocal", reg);
				%> <input type="text"
				name="txtCodigo" id="txtCodigo" readonly
				value="<%out.println(reg.getIdlocal());%>" />
			</td>
		</tr>

		<tr>
			<td><em>Local:</em></td>
			<td>
				<%
					request.setAttribute("regLocal", reg);
				%> <input type="text"
				name="txtNombre" id="txtNombre"
				value="<%out.println(reg.getNombre());%>" />
			</td>
		</tr>
		<tr>
			<td><em>Direccion:</em></td>
			<td>
				<%
					request.setAttribute("regLocal", reg);
				%> <input type="text"
				name="txtDireccion" id="txtDireccion"
				value="<%out.println(reg.getDireccion());%>" />
			</td>
		</tr>

		<tr>
			<td><em>Telefono:</em></td>
			<td>
				<%
					request.setAttribute("regLocal", reg);
				%> <input type="text"
				name="txtTelefono" id="txtTelefono"
				value="<%out.println(reg.getTelefono());%>" />
			</td>
		</tr>

		<tr>
			<td><em>Correo:</em></td>
			<td>
				<%
					request.setAttribute("regLocal", reg);
				%> <input type="text"
				name="txtCorreo" id="txtCorreo"
				value="<%out.println(reg.getCorreo());%>" />
			</td>
		</tr>

		<tr>
			<td><em>Descripcion:</em></td>
			<td>
				<%
					request.setAttribute("regLocal", reg);
				%> <input type="text"
				name="txtDescripcion" id="txtDescripcion"
				value="<%out.println(reg.getDescripcion());%>" />
			</td>
		</tr>

		<tr>
			<td><em>Administrador:</em></td>
			<td>
				<%
					GestionAdministrador Adminis = new GestionAdministrador();
					Collection<Administrador> todos = Adminis.listar();
					request.setAttribute("regAdministrador", todos);
				%> <select name=cboAdministrador style="width: 300px">
					<%
						String tipo = " ";
						for (Administrador c : todos) {
							if (!tipo.equals(c.getPersona().getPaterno())) {
								if (reg.getIdadministrador() == c.getIdadministrador()) {
									out.println("<option value=" + c.getIdadministrador()
											+ " selected >" + c.getPersona().getPaterno() + " "
											+ c.getPersona().getMaterno() + " "
											+ c.getPersona().getNombres() + "</option>");
								} else {
									out.println("<option value=" + c.getIdadministrador()
											+ ">" + c.getPersona().getPaterno() + " "
											+ c.getPersona().getMaterno() + " "
											+ c.getPersona().getNombres() + "</option>");
								}
							}
							tipo = c.getPersona().getPaterno();
						}
					%>

			</select>

			</td>
		</tr>


		<tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td><input type="button" name="button" id="btnCancelar"
				value="Cancelar" onclick="window.location = 'Locales.jsp'" /></td>
			<td><input type="submit" name="button" id="btnGuardar"
				value="Grabar" /></td>
		</tr>
	</table>
</form>


<%@include file="pie.jsp"%>